package com.bk.test;

import java.util.Date;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class MQSender {
	@Autowired
	private AmqpTemplate rabbitmqTemplate;

	public void send() {
		String content = "hello" + new Date();
		System.out.println("Sender chenzilong:" + content);
		this.rabbitmqTemplate.convertAndSend("hello", content);
	}
	//订阅
	public void sendfanout() {
		String context = "hi, fanout msg ";
		System.out.println("Sender : " + context);
		this.rabbitmqTemplate.convertAndSend("fanoutExchange", "", context);
	}
}
